import os 
# File paths

q_lost00 = "q_lost00"
output_file = '20241109_new.txt'  # Output file path

print("Current Directory:", os.getcwd())

# Open the input and output files
with open(output_file, 'w', encoding='utf-8') as outfile:
    fileType = ''
    
    for line in os.listdir(q_lost00):
        if line.startswith('S'):
            fileType = '01'
        if line.startswith('V'): 
            fileType = '02'
        if line.startswith('Y'): 
            fileType = '03'
        if line.startswith('Q'): 
            fileType = '0B'
        if line.startswith('P'): 
            fileType = '0C'
        if line.startswith('J'): 
            fileType = '0D'
        # Convert each character in the line to its hexadecimal representation
        hex_line = ''.join(f'{ord(char):02x}' for char in line)
        # Write the hex string to the output file
        outfile.write('xadd FTP01 * msg 00667000042007080400010004200200000211790000010000002022101309550304200708' + fileType + hex_line.upper() + '0000000000000000000000000000000000006E9CA90A548BAA16E57673F7D5C4C004\n')

print(f"Hex data saved to {output_file}")